package com.mob.tools.utils;

import android.content.ContentResolver;
import android.content.ContentValues;
import android.content.Context;
import android.content.res.Resources;
import android.database.Cursor;
import android.graphics.Point;
import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.provider.MediaStore.Images.Media;
import android.text.TextUtils;
import android.util.DisplayMetrics;
import android.view.Display;
import android.view.WindowManager;
import com.mob.tools.MobLog;
import com.mob.tools.log.NLog;
import com.mob.tools.network.KVPair;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.PrintStream;
import java.lang.reflect.Method;
import java.net.URL;
import java.net.URLDecoder;
import java.text.ParsePosition;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.Iterator;
import java.util.Set;

public class R
{
  private static float density;
  private static int deviceWidth;
  private static Object rp;

  public static void clearCache(Context paramContext)
    throws Throwable
  {
    deleteFileAndFolder(new File(getCachePath(paramContext, null)));
  }

  public static String contentUriToPath(Context paramContext, Uri paramUri)
  {
    if (paramUri == null);
    while (true)
    {
      return null;
      if (new File(paramUri.getPath()).exists())
        return paramUri.getPath();
      try
      {
        int i = Build.VERSION.SDK_INT;
        Cursor localCursor = null;
        if (i >= 19)
        {
          Class localClass = Class.forName("android.provider.DocumentsContract");
          Method localMethod1 = localClass.getMethod("isDocumentUri", new Class[] { Context.class, Uri.class });
          localMethod1.setAccessible(true);
          boolean bool1 = Boolean.TRUE.equals(localMethod1.invoke(null, new Object[] { paramContext, paramUri }));
          localCursor = null;
          if (bool1)
          {
            Method localMethod2 = localClass.getMethod("getDocumentId", new Class[] { Uri.class });
            localMethod2.setAccessible(true);
            String str1 = String.valueOf(localMethod2.invoke(null, new Object[] { paramUri })).split(":")[1];
            String[] arrayOfString1 = { "_data" };
            String[] arrayOfString2 = { str1 };
            localCursor = paramContext.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, arrayOfString1, "_id=?", arrayOfString2, null);
          }
        }
        if (localCursor == null)
          localCursor = paramContext.getContentResolver().query(paramUri, null, null, null, null);
        if (localCursor != null)
        {
          boolean bool2 = localCursor.moveToFirst();
          String str2 = null;
          if (bool2)
            str2 = localCursor.getString(localCursor.getColumnIndex("_data"));
          localCursor.close();
          return str2;
        }
      }
      catch (Throwable localThrowable)
      {
        MobLog.getInstance().w(localThrowable);
      }
    }
    return null;
  }

  public static void copyFile(FileInputStream paramFileInputStream, FileOutputStream paramFileOutputStream)
    throws Throwable
  {
    byte[] arrayOfByte = new byte[65536];
    for (int i = paramFileInputStream.read(arrayOfByte); i > 0; i = paramFileInputStream.read(arrayOfByte))
      paramFileOutputStream.write(arrayOfByte, 0, i);
    paramFileInputStream.close();
    paramFileOutputStream.close();
  }

  public static boolean copyFile(String paramString1, String paramString2)
  {
    if ((TextUtils.isEmpty(paramString1)) || (TextUtils.isEmpty(paramString2)));
    while (!new File(paramString1).exists())
      return false;
    try
    {
      copyFile(new FileInputStream(paramString1), new FileOutputStream(paramString2));
      return true;
    }
    catch (Throwable localThrowable)
    {
    }
    return false;
  }

  public static int[] covertTimeInYears(long paramLong)
  {
    long l1 = System.currentTimeMillis() - paramLong;
    if (l1 <= 0L)
      return new int[] { 0, 0 };
    long l2 = l1 / 1000L;
    if (l2 < 60L)
    {
      int[] arrayOfInt6 = new int[2];
      arrayOfInt6[0] = ((int)l2);
      arrayOfInt6[1] = 0;
      return arrayOfInt6;
    }
    long l3 = l2 / 60L;
    if (l3 < 60L)
    {
      int[] arrayOfInt5 = new int[2];
      arrayOfInt5[0] = ((int)l3);
      arrayOfInt5[1] = 1;
      return arrayOfInt5;
    }
    long l4 = l3 / 60L;
    if (l4 < 24L)
    {
      int[] arrayOfInt4 = new int[2];
      arrayOfInt4[0] = ((int)l4);
      arrayOfInt4[1] = 2;
      return arrayOfInt4;
    }
    long l5 = l4 / 24L;
    if (l5 < 30L)
    {
      int[] arrayOfInt3 = new int[2];
      arrayOfInt3[0] = ((int)l5);
      arrayOfInt3[1] = 3;
      return arrayOfInt3;
    }
    long l6 = l5 / 30L;
    if (l6 < 12L)
    {
      int[] arrayOfInt2 = new int[2];
      arrayOfInt2[0] = ((int)l6);
      arrayOfInt2[1] = 4;
      return arrayOfInt2;
    }
    long l7 = l6 / 12L;
    int[] arrayOfInt1 = new int[2];
    arrayOfInt1[0] = ((int)l7);
    arrayOfInt1[1] = 5;
    return arrayOfInt1;
  }

  public static long dateStrToLong(String paramString)
  {
    return new SimpleDateFormat("yyyy-MM-dd").parse(paramString, new ParsePosition(0)).getTime();
  }

  public static long dateToLong(String paramString)
  {
    try
    {
      Date localDate = new Date(paramString);
      Calendar localCalendar = Calendar.getInstance();
      localCalendar.setTime(localDate);
      long l = localCalendar.getTimeInMillis();
      return l;
    }
    catch (Throwable localThrowable)
    {
      MobLog.getInstance().w(localThrowable);
    }
    return 0L;
  }

  public static Bundle decodeUrl(String paramString)
  {
    Bundle localBundle = new Bundle();
    if (paramString != null)
    {
      String[] arrayOfString1 = paramString.split("&");
      int i = arrayOfString1.length;
      int j = 0;
      if (j < i)
      {
        String[] arrayOfString2 = arrayOfString1[j].split("=");
        if ((arrayOfString2.length < 2) || (arrayOfString2[1] == null))
          localBundle.putString(URLDecoder.decode(arrayOfString2[0]), "");
        while (true)
        {
          j++;
          break;
          localBundle.putString(URLDecoder.decode(arrayOfString2[0]), URLDecoder.decode(arrayOfString2[1]));
        }
      }
    }
    return localBundle;
  }

  public static void deleteFileAndFolder(File paramFile)
    throws Throwable
  {
    if ((paramFile == null) || (!paramFile.exists()))
      return;
    if (paramFile.isFile())
    {
      paramFile.delete();
      return;
    }
    String[] arrayOfString = paramFile.list();
    if ((arrayOfString == null) || (arrayOfString.length <= 0))
    {
      paramFile.delete();
      return;
    }
    int i = arrayOfString.length;
    int j = 0;
    if (j < i)
    {
      File localFile = new File(paramFile, arrayOfString[j]);
      if (localFile.isDirectory())
        deleteFileAndFolder(localFile);
      while (true)
      {
        j++;
        break;
        localFile.delete();
      }
    }
    paramFile.delete();
  }

  public static void deleteFilesInFolder(File paramFile)
    throws Throwable
  {
    if ((paramFile == null) || (!paramFile.exists()));
    String[] arrayOfString;
    do
    {
      return;
      if (paramFile.isFile())
      {
        paramFile.delete();
        return;
      }
      arrayOfString = paramFile.list();
    }
    while ((arrayOfString == null) || (arrayOfString.length <= 0));
    int i = arrayOfString.length;
    int j = 0;
    label44: File localFile;
    if (j < i)
    {
      localFile = new File(paramFile, arrayOfString[j]);
      if (!localFile.isDirectory())
        break label81;
      deleteFilesInFolder(localFile);
    }
    while (true)
    {
      j++;
      break label44;
      break;
      label81: localFile.delete();
    }
  }

  public static int designToDevice(Context paramContext, float paramFloat, int paramInt)
  {
    if (density <= 0.0F)
      density = paramContext.getResources().getDisplayMetrics().density;
    return (int)(0.5F + paramInt * density / paramFloat);
  }

  public static int designToDevice(Context paramContext, int paramInt1, int paramInt2)
  {
    int[] arrayOfInt;
    if (deviceWidth == 0)
    {
      arrayOfInt = getScreenSize(paramContext);
      if (arrayOfInt[0] >= arrayOfInt[1])
        break label46;
    }
    label46: for (int i = arrayOfInt[0]; ; i = arrayOfInt[1])
    {
      deviceWidth = i;
      return (int)(0.5F + paramInt2 * deviceWidth / paramInt1);
    }
  }

  private static int digit(int paramInt1, int paramInt2)
  {
    int i;
    if ((paramInt2 < 2) || (paramInt2 > 36))
      i = -1;
    while (true)
    {
      return i;
      i = -1;
      if ((48 <= paramInt1) && (paramInt1 <= 57))
        i = paramInt1 - 48;
      while (i >= paramInt2)
      {
        return -1;
        if ((97 <= paramInt1) && (paramInt1 <= 122))
          i = 10 + (paramInt1 - 97);
        else if ((65 <= paramInt1) && (paramInt1 <= 90))
          i = 10 + (paramInt1 - 65);
      }
    }
  }

  public static int dipToPx(Context paramContext, int paramInt)
  {
    if (density <= 0.0F)
      density = paramContext.getResources().getDisplayMetrics().density;
    return (int)(0.5F + paramInt * density);
  }

  public static String encodeUrl(Bundle paramBundle)
  {
    if (paramBundle == null)
      return "";
    StringBuilder localStringBuilder = new StringBuilder();
    int i = 1;
    Iterator localIterator = paramBundle.keySet().iterator();
    if (localIterator.hasNext())
    {
      String str = (String)localIterator.next();
      Object localObject = paramBundle.get(str);
      if (localObject == null)
        localObject = "";
      if (i != 0)
        i = 0;
      while (true)
      {
        localStringBuilder.append(Data.urlEncode(str) + "=" + Data.urlEncode(String.valueOf(localObject)));
        break;
        localStringBuilder.append("&");
      }
    }
    return localStringBuilder.toString();
  }

  public static String encodeUrl(ArrayList<KVPair<String>> paramArrayList)
  {
    if (paramArrayList == null)
      return null;
    StringBuilder localStringBuilder = new StringBuilder();
    int i = 0;
    Iterator localIterator = paramArrayList.iterator();
    while (localIterator.hasNext())
    {
      KVPair localKVPair = (KVPair)localIterator.next();
      if (i > 0)
        localStringBuilder.append('&');
      String str1 = localKVPair.name;
      String str2 = (String)localKVPair.value;
      if (str1 != null)
      {
        if (str2 == null)
          str2 = "";
        localStringBuilder.append(Data.urlEncode(str1) + "=" + Data.urlEncode(str2));
        i++;
      }
    }
    return localStringBuilder.toString();
  }

  public static <T> T forceCast(Object paramObject)
  {
    return forceCast(paramObject, null);
  }

  public static <T> T forceCast(Object paramObject, T paramT)
  {
    boolean bool1 = true;
    if (paramObject == null)
      return paramT;
    if ((paramObject instanceof Byte))
    {
      int m = ((Byte)paramObject).byteValue();
      if ((paramT instanceof Boolean))
      {
        if (m != 0);
        for (boolean bool2 = bool1; ; bool2 = false)
          return Boolean.valueOf(bool2);
      }
      if ((paramT instanceof Short))
        return Short.valueOf((short)m);
      if ((paramT instanceof Character))
        return Character.valueOf((char)m);
      if ((paramT instanceof Integer))
        return Integer.valueOf(m);
      if ((paramT instanceof Float))
        return Float.valueOf(m);
      if ((paramT instanceof Long))
        return Long.valueOf(m);
      if ((paramT instanceof Double))
        return Double.valueOf(m);
    }
    else if ((paramObject instanceof Character))
    {
      int k = ((Character)paramObject).charValue();
      if ((paramT instanceof Byte))
        return Byte.valueOf((byte)k);
      if ((paramT instanceof Boolean))
      {
        if (k != 0);
        while (true)
        {
          return Boolean.valueOf(bool1);
          bool1 = false;
        }
      }
      if ((paramT instanceof Short))
        return Short.valueOf((short)k);
      if ((paramT instanceof Integer))
        return Integer.valueOf(k);
      if ((paramT instanceof Float))
        return Float.valueOf(k);
      if ((paramT instanceof Long))
        return Long.valueOf(k);
      if ((paramT instanceof Double))
        return Double.valueOf(k);
    }
    else if ((paramObject instanceof Short))
    {
      int j = ((Short)paramObject).shortValue();
      if ((paramT instanceof Byte))
        return Byte.valueOf((byte)j);
      if ((paramT instanceof Boolean))
      {
        if (j != 0);
        while (true)
        {
          return Boolean.valueOf(bool1);
          bool1 = false;
        }
      }
      if ((paramT instanceof Character))
        return Character.valueOf((char)j);
      if ((paramT instanceof Integer))
        return Integer.valueOf(j);
      if ((paramT instanceof Float))
        return Float.valueOf(j);
      if ((paramT instanceof Long))
        return Long.valueOf(j);
      if ((paramT instanceof Double))
        return Double.valueOf(j);
    }
    else if ((paramObject instanceof Integer))
    {
      int i = ((Integer)paramObject).intValue();
      if ((paramT instanceof Byte))
        return Byte.valueOf((byte)i);
      if ((paramT instanceof Boolean))
      {
        if (i != 0);
        while (true)
        {
          return Boolean.valueOf(bool1);
          bool1 = false;
        }
      }
      if ((paramT instanceof Character))
        return Character.valueOf((char)i);
      if ((paramT instanceof Short))
        return Short.valueOf((short)i);
      if ((paramT instanceof Float))
        return Float.valueOf(i);
      if ((paramT instanceof Long))
        return Long.valueOf(i);
      if ((paramT instanceof Double))
        return Double.valueOf(i);
    }
    else if ((paramObject instanceof Float))
    {
      float f = ((Float)paramObject).floatValue();
      if ((paramT instanceof Byte))
        return Byte.valueOf((byte)(int)f);
      if ((paramT instanceof Boolean))
      {
        if (f != 0.0F);
        while (true)
        {
          return Boolean.valueOf(bool1);
          bool1 = false;
        }
      }
      if ((paramT instanceof Character))
        return Character.valueOf((char)(int)f);
      if ((paramT instanceof Short))
        return Short.valueOf((short)(int)f);
      if ((paramT instanceof Integer))
        return Integer.valueOf((int)f);
      if ((paramT instanceof Long))
        return Long.valueOf(()f);
      if ((paramT instanceof Double))
        return Double.valueOf(f);
    }
    else if ((paramObject instanceof Long))
    {
      long l = ((Long)paramObject).longValue();
      if ((paramT instanceof Byte))
        return Byte.valueOf((byte)(int)l);
      if ((paramT instanceof Boolean))
      {
        if (l != 0L);
        while (true)
        {
          return Boolean.valueOf(bool1);
          bool1 = false;
        }
      }
      if ((paramT instanceof Character))
        return Character.valueOf((char)(int)l);
      if ((paramT instanceof Short))
        return Short.valueOf((short)(int)l);
      if ((paramT instanceof Integer))
        return Integer.valueOf((int)l);
      if ((paramT instanceof Float))
        return Float.valueOf((float)l);
      if ((paramT instanceof Double))
        return Double.valueOf(l);
    }
    else if ((paramObject instanceof Double))
    {
      double d = ((Double)paramObject).doubleValue();
      if ((paramT instanceof Byte))
        return Byte.valueOf((byte)(int)d);
      if ((paramT instanceof Boolean))
      {
        if (d != 0.0D);
        while (true)
        {
          return Boolean.valueOf(bool1);
          bool1 = false;
        }
      }
      if ((paramT instanceof Character))
        return Character.valueOf((char)(int)d);
      if ((paramT instanceof Short))
        return Short.valueOf((short)(int)d);
      if ((paramT instanceof Integer))
        return Integer.valueOf((int)d);
      if ((paramT instanceof Float))
        return Float.valueOf((float)d);
      if ((paramT instanceof Long))
        return Long.valueOf(()d);
    }
    return paramObject;
  }

  public static int getAnimRes(Context paramContext, String paramString)
  {
    return getResId(paramContext, "anim", paramString);
  }

  public static int getBitmapRes(Context paramContext, String paramString)
  {
    return getResId(paramContext, "drawable", paramString);
  }

  public static String getCachePath(Context paramContext, String paramString)
  {
    Object localObject = paramContext.getFilesDir().getAbsolutePath() + "/Mob/cache/";
    DeviceHelper localDeviceHelper = DeviceHelper.getInstance(paramContext);
    try
    {
      if (localDeviceHelper.getSdcardState())
      {
        String str = localDeviceHelper.getSdcardPath() + "/Mob/" + localDeviceHelper.getPackageName() + "/cache/";
        localObject = str;
      }
      if (!TextUtils.isEmpty(paramString))
        localObject = (String)localObject + paramString + "/";
      File localFile = new File((String)localObject);
      if (!localFile.exists())
        localFile.mkdirs();
      return localObject;
    }
    catch (Throwable localThrowable)
    {
      while (true)
        MobLog.getInstance().d(localThrowable);
    }
  }

  public static String getCacheRoot(Context paramContext)
  {
    String str = paramContext.getFilesDir().getAbsolutePath() + "/Mob/";
    DeviceHelper localDeviceHelper = DeviceHelper.getInstance(paramContext);
    if (localDeviceHelper.getSdcardState())
      str = localDeviceHelper.getSdcardPath() + "/Mob/";
    File localFile = new File(str);
    if (!localFile.exists())
      localFile.mkdirs();
    return str;
  }

  public static int getColorRes(Context paramContext, String paramString)
  {
    return getResId(paramContext, "color", paramString);
  }

  public static long getFileSize(File paramFile)
    throws Throwable
  {
    if (!paramFile.exists())
      return 0L;
    if (paramFile.isDirectory())
    {
      String[] arrayOfString = paramFile.list();
      int i = 0;
      for (int j = 0; j < arrayOfString.length; j++)
      {
        File localFile = new File(paramFile, arrayOfString[j]);
        i = (int)(i + getFileSize(localFile));
      }
      return i;
    }
    return paramFile.length();
  }

  public static long getFileSize(String paramString)
    throws Throwable
  {
    if (TextUtils.isEmpty(paramString))
      return 0L;
    return getFileSize(new File(paramString));
  }

  public static int getIdRes(Context paramContext, String paramString)
  {
    return getResId(paramContext, "id", paramString);
  }

  public static String getImageCachePath(Context paramContext)
  {
    return getCachePath(paramContext, "images");
  }

  public static int getLayoutRes(Context paramContext, String paramString)
  {
    return getResId(paramContext, "layout", paramString);
  }

  public static int getPluralsRes(Context paramContext, String paramString)
  {
    return getResId(paramContext, "plurals", paramString);
  }

  public static int getRawRes(Context paramContext, String paramString)
  {
    return getResId(paramContext, "raw", paramString);
  }

  public static int getResId(Context paramContext, String paramString1, String paramString2)
  {
    if ((paramContext == null) || (TextUtils.isEmpty(paramString1)) || (TextUtils.isEmpty(paramString2)))
      return 0;
    Object localObject = rp;
    int i = 0;
    if (localObject != null);
    try
    {
      Method localMethod = rp.getClass().getMethod("getResId", new Class[] { Context.class, String.class, String.class });
      localMethod.setAccessible(true);
      int j = ((Integer)localMethod.invoke(rp, new Object[] { paramContext, paramString1, paramString2 })).intValue();
      i = j;
      if (i <= 0)
      {
        str = paramContext.getPackageName();
        if (TextUtils.isEmpty(str))
          return i;
      }
    }
    catch (Throwable localThrowable)
    {
      String str;
      while (true)
      {
        MobLog.getInstance().d(localThrowable);
        i = 0;
      }
      if (i <= 0)
      {
        i = paramContext.getResources().getIdentifier(paramString2, paramString1, str);
        if (i <= 0)
          i = paramContext.getResources().getIdentifier(paramString2.toLowerCase(), paramString1, str);
      }
      if (i <= 0)
        System.err.println("failed to parse " + paramString1 + " resource \"" + paramString2 + "\"");
    }
    return i;
  }

  public static int getScreenHeight(Context paramContext)
  {
    return getScreenSize(paramContext)[1];
  }

  public static int[] getScreenSize(Context paramContext)
  {
    // Byte code:
    //   0: aload_0
    //   1: ldc_w 529
    //   4: invokevirtual 532	android/content/Context:getSystemService	(Ljava/lang/String;)Ljava/lang/Object;
    //   7: checkcast 534	android/view/WindowManager
    //   10: astore_3
    //   11: aload_3
    //   12: ifnonnull +29 -> 41
    //   15: iconst_2
    //   16: newarray int
    //   18: dup
    //   19: iconst_0
    //   20: iconst_0
    //   21: iastore
    //   22: dup
    //   23: iconst_1
    //   24: iconst_0
    //   25: iastore
    //   26: areturn
    //   27: astore_1
    //   28: invokestatic 140	com/mob/tools/MobLog:getInstance	()Lcom/mob/tools/log/NLog;
    //   31: aload_1
    //   32: invokevirtual 146	com/mob/tools/log/NLog:w	(Ljava/lang/Throwable;)I
    //   35: pop
    //   36: aconst_null
    //   37: astore_3
    //   38: goto -27 -> 11
    //   41: aload_3
    //   42: invokeinterface 538 1 0
    //   47: astore 4
    //   49: getstatic 48	android/os/Build$VERSION:SDK_INT	I
    //   52: bipush 13
    //   54: if_icmpge +45 -> 99
    //   57: new 283	android/util/DisplayMetrics
    //   60: dup
    //   61: invokespecial 539	android/util/DisplayMetrics:<init>	()V
    //   64: astore 5
    //   66: aload 4
    //   68: aload 5
    //   70: invokevirtual 545	android/view/Display:getMetrics	(Landroid/util/DisplayMetrics;)V
    //   73: iconst_2
    //   74: newarray int
    //   76: astore 6
    //   78: aload 6
    //   80: iconst_0
    //   81: aload 5
    //   83: getfield 548	android/util/DisplayMetrics:widthPixels	I
    //   86: iastore
    //   87: aload 6
    //   89: iconst_1
    //   90: aload 5
    //   92: getfield 551	android/util/DisplayMetrics:heightPixels	I
    //   95: iastore
    //   96: aload 6
    //   98: areturn
    //   99: new 553	android/graphics/Point
    //   102: dup
    //   103: invokespecial 554	android/graphics/Point:<init>	()V
    //   106: astore 7
    //   108: aload 4
    //   110: invokevirtual 501	java/lang/Object:getClass	()Ljava/lang/Class;
    //   113: ldc_w 556
    //   116: iconst_1
    //   117: anewarray 52	java/lang/Class
    //   120: dup
    //   121: iconst_0
    //   122: ldc_w 553
    //   125: aastore
    //   126: invokevirtual 64	java/lang/Class:getMethod	(Ljava/lang/String;[Ljava/lang/Class;)Ljava/lang/reflect/Method;
    //   129: astore 10
    //   131: aload 10
    //   133: iconst_1
    //   134: invokevirtual 70	java/lang/reflect/Method:setAccessible	(Z)V
    //   137: aload 10
    //   139: aload 4
    //   141: iconst_1
    //   142: anewarray 4	java/lang/Object
    //   145: dup
    //   146: iconst_0
    //   147: aload 7
    //   149: aastore
    //   150: invokevirtual 80	java/lang/reflect/Method:invoke	(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;
    //   153: pop
    //   154: iconst_2
    //   155: newarray int
    //   157: astore 12
    //   159: aload 12
    //   161: iconst_0
    //   162: aload 7
    //   164: getfield 559	android/graphics/Point:x	I
    //   167: iastore
    //   168: aload 12
    //   170: iconst_1
    //   171: aload 7
    //   173: getfield 562	android/graphics/Point:y	I
    //   176: iastore
    //   177: aload 12
    //   179: areturn
    //   180: astore 8
    //   182: invokestatic 140	com/mob/tools/MobLog:getInstance	()Lcom/mob/tools/log/NLog;
    //   185: aload 8
    //   187: invokevirtual 146	com/mob/tools/log/NLog:w	(Ljava/lang/Throwable;)I
    //   190: pop
    //   191: iconst_2
    //   192: newarray int
    //   194: dup
    //   195: iconst_0
    //   196: iconst_0
    //   197: iastore
    //   198: dup
    //   199: iconst_1
    //   200: iconst_0
    //   201: iastore
    //   202: areturn
    //
    // Exception table:
    //   from	to	target	type
    //   0	11	27	java/lang/Throwable
    //   99	177	180	java/lang/Throwable
  }

  public static int getScreenWidth(Context paramContext)
  {
    return getScreenSize(paramContext)[0];
  }

  public static int getStringArrayRes(Context paramContext, String paramString)
  {
    return getResId(paramContext, "array", paramString);
  }

  public static int getStringRes(Context paramContext, String paramString)
  {
    return getResId(paramContext, "string", paramString);
  }

  public static int getStyleRes(Context paramContext, String paramString)
  {
    return getResId(paramContext, "style", paramString);
  }

  public static int getTextLengthInWord(String paramString)
  {
    char[] arrayOfChar;
    int i;
    int j;
    if (paramString == null)
    {
      arrayOfChar = new char[0];
      i = 0;
      j = 0;
      label12: if (j >= arrayOfChar.length)
        break label55;
      if (arrayOfChar[j] >= 'Ā')
        break label49;
    }
    label49: for (int k = 1; ; k = 2)
    {
      i += k;
      j++;
      break label12;
      arrayOfChar = paramString.toCharArray();
      break;
    }
    label55: return i;
  }

  private static Throwable invalidInt(String paramString)
    throws Throwable
  {
    throw new Throwable("Invalid int: \"" + paramString + "\"");
  }

  public static Date longToDate(long paramLong)
  {
    Calendar localCalendar = Calendar.getInstance();
    localCalendar.setTimeInMillis(paramLong);
    return localCalendar.getTime();
  }

  public static String longToTime(long paramLong, int paramInt)
  {
    String str = "yyyy-MM-dd kk:mm:ss";
    switch (paramInt)
    {
    default:
    case 12:
    case 10:
    case 5:
    case 2:
    case 1:
    }
    while (true)
    {
      return new SimpleDateFormat(str).format(Long.valueOf(paramLong));
      str = "yyyy-MM-dd kk:mm";
      continue;
      str = "yyyy-MM-dd kk";
      continue;
      str = "yyyy-MM-dd";
      continue;
      str = "yyyy-MM";
      continue;
      str = "yyyy";
    }
  }

  public static int parseInt(String paramString)
    throws Throwable
  {
    return parseInt(paramString, 10);
  }

  public static int parseInt(String paramString, int paramInt)
    throws Throwable
  {
    if ((paramInt < 2) || (paramInt > 36))
      throw new Throwable("Invalid radix: " + paramInt);
    if (paramString == null)
      throw invalidInt(paramString);
    int i = paramString.length();
    if (i == 0)
      throw invalidInt(paramString);
    if (paramString.charAt(0) == '-');
    int j;
    for (boolean bool = true; ; bool = false)
    {
      j = 0;
      if (!bool)
        break;
      j = 0 + 1;
      if (j != i)
        break;
      throw invalidInt(paramString);
    }
    return parseInt(paramString, j, paramInt, bool);
  }

  private static int parseInt(String paramString, int paramInt1, int paramInt2, boolean paramBoolean)
    throws Throwable
  {
    int i = -2147483648 / paramInt2;
    int j = 0;
    int k = paramString.length();
    int n;
    for (int m = paramInt1; m < k; m = n)
    {
      n = m + 1;
      int i1 = digit(paramString.charAt(m), paramInt2);
      if (i1 == -1)
        throw invalidInt(paramString);
      if (i > j)
        throw invalidInt(paramString);
      int i2 = j * paramInt2 - i1;
      if (i2 > j)
        throw invalidInt(paramString);
      j = i2;
    }
    if (!paramBoolean)
    {
      j = -j;
      if (j < 0)
        throw invalidInt(paramString);
    }
    return j;
  }

  public static long parseLong(String paramString)
    throws Throwable
  {
    return parseLong(paramString, 10);
  }

  public static long parseLong(String paramString, int paramInt)
    throws Throwable
  {
    if ((paramInt < 2) || (paramInt > 36))
      throw new Throwable("Invalid radix: " + paramInt);
    if (paramString == null)
      throw new Throwable("Invalid long: \"" + paramString + "\"");
    int i = paramString.length();
    if (i == 0)
      throw new Throwable("Invalid long: \"" + paramString + "\"");
    if (paramString.charAt(0) == '-');
    int j;
    for (boolean bool = true; ; bool = false)
    {
      j = 0;
      if (!bool)
        break;
      j = 0 + 1;
      if (j != i)
        break;
      throw new Throwable("Invalid long: \"" + paramString + "\"");
    }
    return parseLong(paramString, j, paramInt, bool);
  }

  private static long parseLong(String paramString, int paramInt1, int paramInt2, boolean paramBoolean)
    throws Throwable
  {
    long l1 = -9223372036854775808L / paramInt2;
    long l2 = 0L;
    long l3 = paramString.length();
    int j;
    for (int i = paramInt1; i < l3; i = j)
    {
      j = i + 1;
      int k = digit(paramString.charAt(i), paramInt2);
      if (k == -1)
        throw new Throwable("Invalid long: \"" + paramString + "\"");
      if (l1 > l2)
        throw new Throwable("Invalid long: \"" + paramString + "\"");
      long l4 = l2 * paramInt2 - k;
      if (l4 > l2)
        throw new Throwable("Invalid long: \"" + paramString + "\"");
      l2 = l4;
    }
    if (!paramBoolean)
    {
      l2 = -l2;
      if (l2 < 0L)
        throw new Throwable("Invalid long: \"" + paramString + "\"");
    }
    return l2;
  }

  public static Uri pathToContentUri(Context paramContext, String paramString)
  {
    Cursor localCursor = paramContext.getContentResolver().query(MediaStore.Images.Media.EXTERNAL_CONTENT_URI, new String[] { "_id" }, "_data=? ", new String[] { paramString }, null);
    Uri localUri1;
    if ((localCursor != null) && (localCursor.moveToFirst()))
    {
      int i = localCursor.getInt(localCursor.getColumnIndex("_id"));
      localUri1 = Uri.withAppendedPath(Uri.parse("content://media/external/images/media"), "" + i);
    }
    boolean bool;
    do
    {
      return localUri1;
      bool = new File(paramString).exists();
      localUri1 = null;
    }
    while (!bool);
    ContentValues localContentValues = new ContentValues();
    localContentValues.put("_data", paramString);
    Uri localUri2 = MediaStore.Images.Media.EXTERNAL_CONTENT_URI;
    return paramContext.getContentResolver().insert(localUri2, localContentValues);
  }

  public static int pxToDip(Context paramContext, int paramInt)
  {
    if (density <= 0.0F)
      density = paramContext.getResources().getDisplayMetrics().density;
    return (int)(0.5F + paramInt / density);
  }

  // ERROR //
  public static Object readObjectFromFile(String paramString)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokestatic 170	android/text/TextUtils:isEmpty	(Ljava/lang/CharSequence;)Z
    //   4: ifne +85 -> 89
    //   7: new 20	java/io/File
    //   10: dup
    //   11: aload_0
    //   12: invokespecial 27	java/io/File:<init>	(Ljava/lang/String;)V
    //   15: astore_1
    //   16: aload_1
    //   17: invokevirtual 43	java/io/File:exists	()Z
    //   20: istore 7
    //   22: iload 7
    //   24: ifne +71 -> 95
    //   27: aconst_null
    //   28: astore_3
    //   29: aload_3
    //   30: ifnull +59 -> 89
    //   33: new 673	java/io/ObjectInputStream
    //   36: dup
    //   37: new 675	java/util/zip/GZIPInputStream
    //   40: dup
    //   41: new 151	java/io/FileInputStream
    //   44: dup
    //   45: aload_3
    //   46: invokespecial 677	java/io/FileInputStream:<init>	(Ljava/io/File;)V
    //   49: invokespecial 680	java/util/zip/GZIPInputStream:<init>	(Ljava/io/InputStream;)V
    //   52: invokespecial 681	java/io/ObjectInputStream:<init>	(Ljava/io/InputStream;)V
    //   55: astore 4
    //   57: aload 4
    //   59: invokevirtual 684	java/io/ObjectInputStream:readObject	()Ljava/lang/Object;
    //   62: astore 6
    //   64: aload 4
    //   66: invokevirtual 685	java/io/ObjectInputStream:close	()V
    //   69: aload 6
    //   71: areturn
    //   72: astore_2
    //   73: aload_2
    //   74: invokevirtual 688	java/lang/Throwable:printStackTrace	()V
    //   77: aconst_null
    //   78: astore_3
    //   79: goto -50 -> 29
    //   82: astore 5
    //   84: aload 5
    //   86: invokevirtual 688	java/lang/Throwable:printStackTrace	()V
    //   89: aconst_null
    //   90: areturn
    //   91: astore_2
    //   92: goto -19 -> 73
    //   95: aload_1
    //   96: astore_3
    //   97: goto -68 -> 29
    //
    // Exception table:
    //   from	to	target	type
    //   7	16	72	java/lang/Throwable
    //   33	69	82	java/lang/Throwable
    //   16	22	91	java/lang/Throwable
  }

  // ERROR //
  public static boolean saveObjectToFile(String paramString, Object paramObject)
  {
    // Byte code:
    //   0: aload_0
    //   1: invokestatic 170	android/text/TextUtils:isEmpty	(Ljava/lang/CharSequence;)Z
    //   4: ifne +116 -> 120
    //   7: new 20	java/io/File
    //   10: dup
    //   11: aload_0
    //   12: invokespecial 27	java/io/File:<init>	(Ljava/lang/String;)V
    //   15: astore_2
    //   16: aload_2
    //   17: invokevirtual 43	java/io/File:exists	()Z
    //   20: ifeq +8 -> 28
    //   23: aload_2
    //   24: invokevirtual 254	java/io/File:delete	()Z
    //   27: pop
    //   28: aload_2
    //   29: invokevirtual 693	java/io/File:getParentFile	()Ljava/io/File;
    //   32: invokevirtual 43	java/io/File:exists	()Z
    //   35: ifne +11 -> 46
    //   38: aload_2
    //   39: invokevirtual 693	java/io/File:getParentFile	()Ljava/io/File;
    //   42: invokevirtual 465	java/io/File:mkdirs	()Z
    //   45: pop
    //   46: aload_2
    //   47: invokevirtual 696	java/io/File:createNewFile	()Z
    //   50: pop
    //   51: aload_2
    //   52: astore 4
    //   54: aload 4
    //   56: ifnull +64 -> 120
    //   59: new 698	java/io/ObjectOutputStream
    //   62: dup
    //   63: new 700	java/util/zip/GZIPOutputStream
    //   66: dup
    //   67: new 157	java/io/FileOutputStream
    //   70: dup
    //   71: aload 4
    //   73: invokespecial 701	java/io/FileOutputStream:<init>	(Ljava/io/File;)V
    //   76: invokespecial 704	java/util/zip/GZIPOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   79: invokespecial 705	java/io/ObjectOutputStream:<init>	(Ljava/io/OutputStream;)V
    //   82: astore 5
    //   84: aload 5
    //   86: aload_1
    //   87: invokevirtual 709	java/io/ObjectOutputStream:writeObject	(Ljava/lang/Object;)V
    //   90: aload 5
    //   92: invokevirtual 712	java/io/ObjectOutputStream:flush	()V
    //   95: aload 5
    //   97: invokevirtual 713	java/io/ObjectOutputStream:close	()V
    //   100: iconst_1
    //   101: ireturn
    //   102: astore_3
    //   103: aload_3
    //   104: invokevirtual 688	java/lang/Throwable:printStackTrace	()V
    //   107: aconst_null
    //   108: astore 4
    //   110: goto -56 -> 54
    //   113: astore 6
    //   115: aload 6
    //   117: invokevirtual 688	java/lang/Throwable:printStackTrace	()V
    //   120: iconst_0
    //   121: ireturn
    //   122: astore_3
    //   123: goto -20 -> 103
    //
    // Exception table:
    //   from	to	target	type
    //   7	16	102	java/lang/Throwable
    //   59	100	113	java/lang/Throwable
    //   16	28	122	java/lang/Throwable
    //   28	46	122	java/lang/Throwable
    //   46	51	122	java/lang/Throwable
  }

  public static void setResourceProvider(Object paramObject)
  {
    try
    {
      if (paramObject.getClass().getMethod("getResId", new Class[] { Context.class, String.class, String.class }) != null)
        rp = paramObject;
      return;
    }
    catch (Throwable localThrowable)
    {
      MobLog.getInstance().d(localThrowable);
    }
  }

  public static long strToDate(String paramString)
  {
    return new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(paramString, new ParsePosition(0)).getTime();
  }

  public static String toString(Object paramObject)
  {
    if (paramObject == null)
      return "";
    return paramObject.toString();
  }

  public static String toWordText(String paramString, int paramInt)
  {
    char[] arrayOfChar = paramString.toCharArray();
    int i = paramInt * 2;
    StringBuilder localStringBuilder = new StringBuilder();
    int j = arrayOfChar.length;
    for (int k = 0; k < j; k++)
    {
      int m = arrayOfChar[k];
      if (m < 256);
      for (int n = 1; ; n = 2)
      {
        i -= n;
        if (i >= 0)
          break;
        return localStringBuilder.toString();
      }
      localStringBuilder.append(m);
    }
    return localStringBuilder.toString();
  }

  public static Bundle urlToBundle(String paramString)
  {
    int i = paramString.indexOf("://");
    String str;
    if (i >= 0)
      str = "http://" + paramString.substring(i + 1);
    try
    {
      while (true)
      {
        URL localURL = new URL(str);
        Bundle localBundle = decodeUrl(localURL.getQuery());
        localBundle.putAll(decodeUrl(localURL.getRef()));
        return localBundle;
        str = "http://" + paramString;
      }
    }
    catch (Throwable localThrowable)
    {
      MobLog.getInstance().w(localThrowable);
    }
    return new Bundle();
  }
}

/* Location:           C:\Users\user\Desktop\dd28_pcdd720\classes_dex2jar.jar
 * Qualified Name:     com.mob.tools.utils.R
 * JD-Core Version:    0.6.2
 */